package org.aspectsense.examples.adaptivemail;


import org.aspectsense.middleware.interfaces.AntivirusService;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;

public class Antivirus implements BundleActivator {

	private ServiceRegistration serviceRegistration;
	private AntivirusImpl av;

	public void start(BundleContext context) throws Exception {
		
		
		av = new AntivirusImpl();
		 assert serviceRegistration == null;
		
	     serviceRegistration = context.registerService(AntivirusService.class.getName(), av, null);
	    
	}
	
	
	public void stop(BundleContext context) throws Exception {
		 if(serviceRegistration != null)
	        {
	            serviceRegistration.unregister();
	            serviceRegistration = null;
	        }
	}

}
